import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [{
        path: '/',
        redirect: "home"
    }, {
        path: '/home',
        name: 'home',
        component: HomeView,
        meta: {
            keep: true
        }
    },
    {
        path: '/videos',
        name: 'videos',
        component: () =>
            import ('../views/VideosView.vue')
    },
    {
        path: '/search',
        name: 'search',
        component: () =>
            import ('../views/searchView.vue')
    },
    {
        path: '/EnListen',
        name: 'EnListen',
        component: () =>
            import ('../views/EnListenView.vue')
    },
    {
        path: '/materials/lists', //各种资料
        name: 'materials',
        component: () =>
            import ('../views/MaterialsView.vue'),
    },
    {
        path: '/materials/articles', //各种资料详情页(接口)
        name: 'articles',
        component: () =>
            import ('../views/ArticleCopyView.vue'),
    },
    {
        path: '/materials/math', //各种资料详情页
        name: 'math',
        component: () =>
            import ('../views/ArticleView.vue'),
        beforeEnter(to, from, next) {
            console.log(to.query);
            console.log(from.query);
            next();
        }
    },
    {
        path: '/beike', //文库资料页面
        name: 'beike',
        component: () =>
            import ('../views/BeikeView.vue')
    },
    {
        path: '/evaluating', //作文评测
        name: 'evaluating',
        component: () =>
            import ('../views/EvaluatingView.vue')
    },
    {
        path: '/appdown', //下载页面
        name: 'appdown',
        component: () =>
            import ('../views/AppDownView.vue')
    },
    {
        path: '/vip', //vip页面
        name: 'vip',
        component: () =>
            import ('../views/VIPView.vue')
    },
    {
        path: '/login', //登录页面
        name: 'login',
        component: () =>
            import ('../views/LoginView.vue')
    },
    {
        path: '/sngin', //注册页面
        name: 'sngin',
        component: () =>
            import ('../views/SnginView.vue')
    },
    {
        path: '/helpdeta', //帮助页面
        name: 'helpdeta',
        component: () =>
            import ('../views/HelpDetaiView.vue')
    },
    {
        path: '/course', //视频听力详情页
        name: 'course',
        component: () =>
            import ('../views/CourseView.vue')
    },
    {
        path: '/Cecopy', //视频听力详情页(数据请求)
        name: 'Cecopy',
        component: () =>
            import ('../views/CourseCopyView.vue')
    },

]
const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes,
    linkActiveClass: 'topcon',
    scrollBehavior() {
        return { x: 0, y: 0 }
    }
})

export default router